// 实现这个项目的构建任务
const {src, dest, series, parallel} = require('gulp')

//导入gulp-sass
const sass = require('gulp-sass')
//导入gulp-babel
const babel = require('gulp-babel')
//导入imagemin
const imagemin = require('gulp-imagemin')




const image = () => {
    return src('src/assets/images/**', {base: 'src'})
            .pipe(imagemin())
            .pipe(dest('dist'))
}

const style = () => {
    return src('src/assets/styles/*.scss', {base: 'src'})
                .pipe(sass({outputStyle: 'expanded'}))
                .pipe(dest('dist'))
}

const script = () => {
    return src('src/assets/scripts/*.js', {base: 'src'})
                .pipe(babel({presets: ['@babel/preset-env']}))
                .pipe(dest('dist'))
}

module.exports = {
    image,
    style,
    script
}